﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using System.Timers;
using Microsoft.Xna.Framework.Graphics;

namespace Z2.Core
{
	public class Torch : ObjectBase
	{
		private ActionTimer m_test;
		
		private int size = 300;
		private int sizeMax;
		
		public Torch()
			: base(SpriteManager.Instance.LoadSprite("torch", 4, 1))
		{
		    this.IsStatic = true;
			this.MaxHorizontalSpeed = 0;
			this.Sprite.AnimationSpeed = 50;

			

			sizeMax = (size / 100) * 115;
			
			this.m_test = new ActionTimer(50);
			this.m_test.Enabled = true;
			this.Light.Color = new Color(255, 255, 0, 255);
			this.Sprite.Depth = Depth(Depths.Object);
		}

		public override void Update()
		{
			base.Update();
			if (this.m_test.Now())
			{
				int width = RandomGenerator.Random.Next(size, sizeMax);
				int height = RandomGenerator.Random.Next(size, sizeMax);
				this.Light.LightSize = new Rectangle(0, 0, width, height);
			}
		}

		internal override bool CantCollide(ObjectBase obj)
		{
			return true;
		}

	}
}
